package de.voegel.view;

import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JDialog;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;

public class LoadingScreen extends JDialog {
	private final JTextPane loadingText;

	public LoadingScreen() {
		setTitle("Lade Daten");
		setResizable(false);
		setPreferredSize(new Dimension(390, 115));
		getContentPane().setLayout(null);

		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 11, 360, 67);
		getContentPane().add(scrollPane);

		loadingText = new JTextPane();
		loadingText.setFont(new Font("Arial", Font.BOLD, 11));
		loadingText.setEnabled(false);
		loadingText.setEditable(false);
		scrollPane.setViewportView(loadingText);

		setAlwaysOnTop(true);

		pack();
		setLocationRelativeTo(null);
	}

	public void setText(String text) {
		if (loadingText != null) {
			StringBuffer nuilder = new StringBuffer(loadingText.getText());
			nuilder.append("Aktion: " + text + "\n");
			loadingText.setText(nuilder.toString());
		}
	}
}
